package com.dementors.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;

import com.dementors.R;

/**
 * Created by Administrator on 2015/12/4 0004.
 */
public class MyItemView extends FrameLayout {
    private Context context;
    private ImageView iv1,iv2;
    private TextView tv;

    public MyItemView(Context context) {
        this(context, null);
    }

    public MyItemView(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MyItemView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context=context;
        LayoutInflater.from(context).inflate(R.layout.myitemview, this, true);
        initViews();//初始化控件
    }

    private void initViews() {
        iv1= (ImageView) findViewById(R.id.iv_my);
        iv2= (ImageView) findViewById(R.id.iv_arrow);
        tv= (TextView) findViewById(R.id.tv_my);
    }

    public void setText(String text){
        tv.setText(text);
    }

    public void setImage(int res){
        iv1.setImageResource(res);
    }
}
